package com.red.service.impl;

import com.red.mapper.HouseMapper;
import com.red.mapper.OrderMapper;
import com.red.pojo.entity.House;
import com.red.pojo.entity.Order;
import com.red.service.IHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HouseServiceImpl implements IHouseService {

    @Autowired
    private HouseMapper houseMapper;

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public int insertHouse(House house) {
        return houseMapper.insertHouse(house);
    }

    @Override
    public List<House> selectHouseList(House house, int page, int size) {
        int offset = (page - 1) * size;
        return houseMapper.selectHouseList(house, offset, size);
    }

    @Override
    public int selectHouseCount(House house) {
        return houseMapper.selectHouseCount(house);
    }

    @Override
    public House selectHouseByID(int id) {
        return houseMapper.selectHouseByID(id);
    }

    @Override
    public int updateHouse(House house) {
        return houseMapper.updateHouse(house);
    }

    @Override
    public int deleteHouseByID(int id) {
        return houseMapper.deleteHouseByID(id);
    }
}
